#ifndef CORE_CDEVICEMANAGERCONFIG_H_
#define CORE_CDEVICEMANAGERCONFIG_H_

#include <string>

#include "defines.h"

class QXmlStreamReader;
class QXmlStreamWriter;

class CDeviceManagerConfig
{
public:
    CDeviceManagerConfig();
    ~CDeviceManagerConfig();

    bool Read(ZLDeviceConfig &config, const std::string &filename = "./devices.xml");
    bool Write(const ZLDeviceConfig &config, const std::string &filename = "./devices.xml");

protected:
    void parse_zlbase_info(QXmlStreamReader& xml, ZLBaseInfo &zlbase_info);
    void parse_zlbase_device(QXmlStreamReader& xml, ZLBaseDevice &device);
    void parse_peripherals_info(QXmlStreamReader& xml, ZLPeripheralsInfo &peri_info);
    void parse_peripherals_device(QXmlStreamReader& xml, ZLPeripheralsDevice &device);

    void stringify_zlbase_info(QXmlStreamWriter& xml, const ZLBaseInfo &zlbase_info);
    void stringify_zlbase_device(QXmlStreamWriter& xml, const ZLBaseDevice &d);
    void stringify_peripherals_info(QXmlStreamWriter& xml, const ZLPeripheralsInfo &peri_info);
    void stringify_peripherals_device(QXmlStreamWriter& xml, const ZLPeripheralsDevice &d);
};

#endif // CORE_CDEVICEMANAGERCONFIG_H_